package org.huntaway.material.cleaner.manager.model.imp;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.huntaway.kernel.CurrTools;
import org.huntaway.kernel.imp.CurrToolsImp;

public class ConfigManager {
	protected CurrTools curr=new CurrToolsImp();
	/**
	 * @return
	 * 返回tags对应的Document
	 */
	public Document getTagDocument() {
		return parse2Document(curr.getCurrDir() + "/tags.xml");
	}
	public Document parse2Document(String xmlFilePath) {
		SAXReader reader = new SAXReader();
		Document document = null;
		try {
			document = reader.read(new FileReader(new File(xmlFilePath)));
		} catch (DocumentException e) {
			System.out.println(e.getMessage());
			System.out
					.println("读取classpath下xmlFileName文件发生异常，请检查CLASSPATH和文件名是否存在！");
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return document;
	}
}
